export default {
  namespaced:true,
  state:()=>({
    address:{}
  }),
  mutations:{
    addAddress(state,data){
      state.address = data
      this.commit('address/saveAddressToStorage')
    },
    saveAddressToStorage(state) {
      uni.setStorageSync('address',JSON.stringify(state.address))
    }
  },
  getters:{
    myAddress(state) {
      if(!state.address) return ''
      return state.address.provinceName+state.address.cityName+state.address.countyName+state.address.detailInfo
    }
  }
}